#include "rapter/optimization/merging.h"                // mergeCli

#include "rapter/typedefs.h"                            // _2d::PrimitiveT, _3d::PrimitiveT
#include "rapter/util/parse.h"                          // find_switch
#include "rapter/primitives/impl/planePrimitive.hpp"

int merge( int argc, char** argv )
{
    if ( rapter::console::find_switch(argc,argv,"--merge3D") )
    {
        return rapter::Merging::mergeCli< rapter::_3d::PrimitiveContainerT
                                     , rapter::PointContainerT
                                     , rapter::Scalar
                                     , rapter::PointPrimitiveT
                                     , rapter::_3d::PrimitiveT
                                     >( argc, argv );
    }
    else
    {
        return rapter::Merging::mergeCli< rapter::_2d::PrimitiveContainerT
                                     , rapter::PointContainerT
                                     , rapter::Scalar
                                     , rapter::PointPrimitiveT
                                     , rapter::_2d::PrimitiveT
                                     >( argc, argv );
    } //...if find_switch
} //...merge()

template
int rapter::Merging::myMergeCli< rapter::_3d::PrimitiveContainerT
                                     , rapter::PointContainerT
                                     , rapter::Scalar
                                     , rapter::PointPrimitiveT
                                     , rapter::_3d::PrimitiveT
                                     >(
        std::string                         cloud_path,                         //"cloud.ply"
        std::string                         prims_path,                         //"primitives.bonmin.csv"
        std::string                         assoc_path,                         //"points_primitives.csv"
        AnglesT                             angle_gens,                         //{AnglesT::Scalar(90.)}
        size_t                              sizeLimit,                          //if >0, a non-spatial recursive partitioning will happen [default 0]
        int                                 adopt,                              //--adopt    default 0
        float                               patch_population_limit,             //--patch-pop-limit       default 10
        bool                                no_paral,                           //no-paral
        float                               spatial_threshold_mult,             //spatial_threshold_mult
        float                               scale                               //scale
        );
